package delegate;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import InterfazRemota.InterfazRemota;
import InterfazRemota.RestoranException;

import java.util.List;
import java.util.Vector;



import NegocioVO.*;
import InterfazRemota.*;

public class RMI implements InterfazRemotaSwing {

	InterfazRemotaSwing obj = null; 

	
	public RMI() throws MalformedURLException
	{
				
		try 
		{ 
			if (System.getSecurityManager() == null) {
	            System.setSecurityManager(new RMISecurityManager());
	            System.out.println("Security manager installed.");
	        } else {
	            System.out.println("Security manager already exists.");
	        }
	 
			
			
            obj = (InterfazRemotaSwing)Naming.lookup("//localhost/RmiServer");
            //return obj.getMessage(new MessageVO("pepe","ok")); 
        } 
		catch (Exception e) { 
            System.err.println("RmiClient exception: " + e); 
            e.printStackTrace();
        }
	}


	@Override
	public void altaProductosDeposito(EmpleadoVO arg0, ProveedorVO arg1,
			Vector<ItemRequerimientoVO> arg2) throws RestoranException,
			RemoteException {
		obj.altaProductosDeposito(arg0, arg1, arg2);
		
	}


	@Override
	public EmpleadoVO login(EmpleadoVO arg0) throws RestoranException,
			RemoteException {
			EmpleadoVO u=obj.login(arg0);
		return u;
	}



		
	
	
}
